package flc.ast.activity;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

import com.blankj.utilcode.util.ToastUtils;

import flc.ast.BaseAc;
import flc.ast.R;
import flc.ast.databinding.ActivityChangePwdBinding;
import flc.ast.utils.Content;
import flc.ast.view.PasscodeView;
import stark.common.basic.utils.SPUtil;

public class ChangePwdActivity extends BaseAc<ActivityChangePwdBinding> {


    @Override
    protected int onCreate() {
        return R.layout.activity_change_pwd;
    }

    @Override
    protected void initView() {
        mDataBinding.ivChangePwdBack.setOnClickListener(v -> onBackPressed());

        mDataBinding.passcodeView.setLocalPasscode(SPUtil.getString(mContext, Content.myPassword, ""));
        mDataBinding.passcodeView.setListener(new PasscodeView.PasscodeViewListener() {
            @Override
            public void onFail() {
                mDataBinding.passcodeView.getWrongStatusColor();
            }

            @Override
            public void onSuccess(String number) {
                SPUtil.putString(mContext, Content.myPassword, number);
                ToastUtils.showShort(getString(R.string.change_pwd_suc));
                finish();
            }
        });
    }

    @Override
    protected void initData() {

    }
}